package IO;

import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Test4 {
    public static void main(String[] args) throws Exception {
        List<Student> stuList = new ArrayList<>();
      stuList.add(new Student("张三","男","20","88"));
      stuList.add(new Student("李四","女","19","99"));
        FileWriter fw = new FileWriter("student.txt");

        for (int i = 0; i < stuList.size(); i++) {
            Student s = stuList.get(i);
           String str =s.toString();
           fw.write(str);
           fw.write("\r\n");
        }
        fw.close();

    }
}
